import request from '@/utils/request'

/* export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  return request({
    url: '/login/login',
    method: 'post',
    data
  })
}*/
export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  return request({
    url: '/oauth/token?password=' + data.password + '&username=' + data.username + '&grant_type=password',
    method: 'GET',
    data: {}
  })
}
export function getUserMenu(data) {
  return request({
    url: '/v1/sysPermission/menuUserTree',
    method: 'post',
    headers: {
      'Authorization': data
    },
    data: {}
  })
}

export function logout() {
  return request({
    url: '/v1/sysUser/logout',
    method: 'GET'
  })
}
export function getUserInfo(token) {
  return request({
    url: '/v1/sysUser/getSysUserInfo',
    method: 'GET',
    headers: {
      'Authorization': token
    }
  })
}
export function changePassword(data, oldPassword) {
  return request({
    url: '/v1/sysUser/updatePwd?oldPassword=' + oldPassword,
    method: 'POST',
    data: data
  })
}

